<?php

class DbModel {
	
	// DB connection requisites
	private $host;
	private $user;
	private $pass;
	private $db;
	private $reg;
	
	
	public function __construct() {
	 $conf = Registry::get('config');
	 $this->host = $conf->dbhost;
	 $this->user = $conf->dbuser;
	 $this->pass = $conf->dbpass;
	 $this->db = $conf->dbname;
	 $this->connect();
	}

	private function connect(){
	 mysql_connect($this->host, $this->user, $this->pass);
	 if(!mysql_select_db($this->db))
	 throw new DbException('Не могу подключиться к БД'.mysql_error());
	}

	 public function set($name) {
	 
	 $q = mysql_query("SELECT * FROM users");
     echo "В таблице users ".mysql_num_rows($q)." записей";
	  
	  
	 }
	 


}

?>